/*
 * Copyright (c) 2018 Tencent. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
const AbstractModel = require("../../common/abstract_model");

/**
 * EnableAlarm response structure.
 * @class
 */
class EnableAlarmResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * CreateAlarm response structure.
 * @class
 */
class CreateAlarmResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * 1001
         * @type {number || null}
         */
        this.AlarmId = null;

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.AlarmId = 'AlarmId' in params ? params.AlarmId : null;
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * CreateAlarm request structure.
 * @class
 */
class CreateAlarmRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Alarm rule name. specifies the name of the Alarm rule.
         * @type {string || null}
         */
        this.Name = null;

        /**
         * Product ID.
         * @type {number || null}
         */
        this.ProductId = null;

        /**
         * Quota ID.
         * @type {number || null}
         */
        this.QuotaId = null;

        /**
         * Alert metrics 1: quota usage 2: quota usage rate 3: remaining quota 4: remaining quota rate.
         * @type {number || null}
         */
        this.Metrics = null;

        /**
         * Specifies the Alarm threshold. value range: 0-100.
         * @type {number || null}
         */
        this.Threshold = null;

        /**
         * Alarm frequency.
         * @type {number || null}
         */
        this.Frequency = null;

        /**
         *   Member UIN.
         * @type {number || null}
         */
        this.MemberUin = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Name = 'Name' in params ? params.Name : null;
        this.ProductId = 'ProductId' in params ? params.ProductId : null;
        this.QuotaId = 'QuotaId' in params ? params.QuotaId : null;
        this.Metrics = 'Metrics' in params ? params.Metrics : null;
        this.Threshold = 'Threshold' in params ? params.Threshold : null;
        this.Frequency = 'Frequency' in params ? params.Frequency : null;
        this.MemberUin = 'MemberUin' in params ? params.MemberUin : null;

    }
}

/**
 * Alarm Rule Details
 * @class
 */
class Alarm extends  AbstractModel {
    constructor(){
        super();

        /**
         * Alarm rule ID.
         * @type {number || null}
         */
        this.Id = null;

        /**
         * Alarm rule name.
         * @type {string || null}
         */
        this.Name = null;

        /**
         * Product ID
         * @type {number || null}
         */
        this.ProductId = null;

        /**
         * Quota ID.
         * @type {number || null}
         */
        this.QuotaId = null;

        /**
         * Alarm condition.
         * @type {number || null}
         */
        this.Metrics = null;

        /**
         * Alarm frequency.
         * @type {number || null}
         */
        this.Frequency = null;

        /**
         * Specifies the Alarm threshold. valid values: 0-100.
         * @type {number || null}
         */
        this.Threshold = null;

        /**
         * Creator UIN
         * @type {number || null}
         */
        this.OwnerUin = null;

        /**
         * Specifies the uin of the rule owner.
         * @type {number || null}
         */
        this.MemberUin = null;

        /**
         * Specifies the quota name.
         * @type {string || null}
         */
        this.QuotaName = null;

        /**
         * Product name
         * @type {string || null}
         */
        this.ProductName = null;

        /**
         * Whether to delete. 1: not deleted.
2: delete.
         * @type {number || null}
         */
        this.Status = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Id = 'Id' in params ? params.Id : null;
        this.Name = 'Name' in params ? params.Name : null;
        this.ProductId = 'ProductId' in params ? params.ProductId : null;
        this.QuotaId = 'QuotaId' in params ? params.QuotaId : null;
        this.Metrics = 'Metrics' in params ? params.Metrics : null;
        this.Frequency = 'Frequency' in params ? params.Frequency : null;
        this.Threshold = 'Threshold' in params ? params.Threshold : null;
        this.OwnerUin = 'OwnerUin' in params ? params.OwnerUin : null;
        this.MemberUin = 'MemberUin' in params ? params.MemberUin : null;
        this.QuotaName = 'QuotaName' in params ? params.QuotaName : null;
        this.ProductName = 'ProductName' in params ? params.ProductName : null;
        this.Status = 'Status' in params ? params.Status : null;

    }
}

/**
 * EnableAlarm request structure.
 * @class
 */
class EnableAlarmRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Rule ID
         * @type {number || null}
         */
        this.Id = null;

        /**
         * Specifies the member uin of the rule owner.
         * @type {number || null}
         */
        this.MemberUin = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Id = 'Id' in params ? params.Id : null;
        this.MemberUin = 'MemberUin' in params ? params.MemberUin : null;

    }
}

/**
 * DeleteAlarm response structure.
 * @class
 */
class DeleteAlarmResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * DeleteAlarm request structure.
 * @class
 */
class DeleteAlarmRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Rule ID
         * @type {number || null}
         */
        this.Id = null;

        /**
         * Specifies the member uin of the rule owner.
         * @type {number || null}
         */
        this.MemberUin = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Id = 'Id' in params ? params.Id : null;
        this.MemberUin = 'MemberUin' in params ? params.MemberUin : null;

    }
}

/**
 * DescribeAlarms response structure.
 * @class
 */
class DescribeAlarmsResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * Total number.
         * @type {number || null}
         */
        this.Count = null;

        /**
         * List of rules
         * @type {Array.<Alarm> || null}
         */
        this.Data = null;

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Count = 'Count' in params ? params.Count : null;

        if (params.Data) {
            this.Data = new Array();
            for (let z in params.Data) {
                let obj = new Alarm();
                obj.deserialize(params.Data[z]);
                this.Data.push(obj);
            }
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * UpdateAlarm request structure.
 * @class
 */
class UpdateAlarmRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * ID
         * @type {number || null}
         */
        this.Id = null;

        /**
         * Alarm rule name.
         * @type {string || null}
         */
        this.Name = null;

        /**
         * Product ID.
         * @type {number || null}
         */
        this.ProductId = null;

        /**
         * Quota ID.
         * @type {number || null}
         */
        this.QuotaId = null;

        /**
         * 1: quota usage 2: quota usage rate 3: remaining quota 4: remaining quota rate.
         * @type {number || null}
         */
        this.Metrics = null;

        /**
         * Specifies the Alarm threshold. valid values: 0-100.
         * @type {number || null}
         */
        this.Threshold = null;

        /**
         * Alarm frequency.
         * @type {number || null}
         */
        this.Frequency = null;

        /**
         * Specifies the uin of the rule owner.
Operates non-group account rules. this parameter can be omitted.
Operates the organization account rule. specifies the uin of all users under the current rule.
         * @type {number || null}
         */
        this.MemberUin = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Id = 'Id' in params ? params.Id : null;
        this.Name = 'Name' in params ? params.Name : null;
        this.ProductId = 'ProductId' in params ? params.ProductId : null;
        this.QuotaId = 'QuotaId' in params ? params.QuotaId : null;
        this.Metrics = 'Metrics' in params ? params.Metrics : null;
        this.Threshold = 'Threshold' in params ? params.Threshold : null;
        this.Frequency = 'Frequency' in params ? params.Frequency : null;
        this.MemberUin = 'MemberUin' in params ? params.MemberUin : null;

    }
}

/**
 * UpdateAlarm response structure.
 * @class
 */
class UpdateAlarmResponse extends  AbstractModel {
    constructor(){
        super();

        /**
         * The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
         * @type {string || null}
         */
        this.RequestId = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.RequestId = 'RequestId' in params ? params.RequestId : null;

    }
}

/**
 * DescribeAlarms request structure.
 * @class
 */
class DescribeAlarmsRequest extends  AbstractModel {
    constructor(){
        super();

        /**
         * Number of items per page. maximum 100.
         * @type {number || null}
         */
        this.Limit = null;

        /**
         * Offset.
         * @type {number || null}
         */
        this.Offset = null;

        /**
         * Product ID.
         * @type {number || null}
         */
        this.ProductId = null;

        /**
         * Quota ID.
         * @type {number || null}
         */
        this.QuotaId = null;

        /**
         * Alarm, quota name.
         * @type {string || null}
         */
        this.Content = null;

        /**
         * Member uins.
         * @type {Array.<number> || null}
         */
        this.MemberUins = null;

        /**
         * AlAlarm metric.
         * @type {number || null}
         */
        this.Metrics = null;

        /**
         * Rule ID
         * @type {number || null}
         */
        this.Id = null;

    }

    /**
     * @private
     */
    deserialize(params) {
        if (!params) {
            return;
        }
        this.Limit = 'Limit' in params ? params.Limit : null;
        this.Offset = 'Offset' in params ? params.Offset : null;
        this.ProductId = 'ProductId' in params ? params.ProductId : null;
        this.QuotaId = 'QuotaId' in params ? params.QuotaId : null;
        this.Content = 'Content' in params ? params.Content : null;
        this.MemberUins = 'MemberUins' in params ? params.MemberUins : null;
        this.Metrics = 'Metrics' in params ? params.Metrics : null;
        this.Id = 'Id' in params ? params.Id : null;

    }
}

module.exports = {
    EnableAlarmResponse: EnableAlarmResponse,
    CreateAlarmResponse: CreateAlarmResponse,
    CreateAlarmRequest: CreateAlarmRequest,
    Alarm: Alarm,
    EnableAlarmRequest: EnableAlarmRequest,
    DeleteAlarmResponse: DeleteAlarmResponse,
    DeleteAlarmRequest: DeleteAlarmRequest,
    DescribeAlarmsResponse: DescribeAlarmsResponse,
    UpdateAlarmRequest: UpdateAlarmRequest,
    UpdateAlarmResponse: UpdateAlarmResponse,
    DescribeAlarmsRequest: DescribeAlarmsRequest,

}
